import request from "../utils/request";

// 商品列表请求接口
export const goodsIndex = (data?: any) => {
  return new Promise(resolve => {
    request({
      //请求商品列表
      url: "/pcapi/goods/index", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};

// 图片上传请求接口
export const imageUpload = (data?: any) => {
  console.log(data);

  return new Promise(resolve => {
    request({
      //请求图片上传
      method: "post",
      url: "/pcapi/index/upload", // url
      data: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};

// 景区添加请求接口
export const goodsAdd = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/goods/add", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
// 确认编辑商品请求接口
export const goodsEdits = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/goods/update", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
// 商品删除请求接口
export const goodsDeletes = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/goods/del", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
// 商品类型请求接口
export const typeList = (data?: any) => {
  return new Promise(resolve => {
    request({
      url: "/pcapi/goods/type_list", // url
      params: data
    }).then(res => {
      // 成功回调
      resolve(res);
    });
  });
};
